package com.homeproject.trailservice.grpc;

import io.grpc.*;

public class ContextPropagationInterceptor implements ServerInterceptor {
    @Override
    public <ReqT, RespT> ServerCall.Listener<ReqT> interceptCall(ServerCall<ReqT, RespT> serverCall, Metadata metadata, ServerCallHandler<ReqT, RespT> serverCallHandler) {
        Context ctx = Context.current().withValue(GrpcContextKeys.TEST_KEY,"this is propagated from interceptor");
        return Contexts.interceptCall(ctx,serverCall,metadata,serverCallHandler);
    }
}
